<script>
  import {
    systemInfo
  } from "@/libs/util";
  export default {
    onLaunch: function() {
      console.log('App Launch')
      //#ifdef APP-PLUS
      console.log('App Launch clientid:' + plus.push.getClientInfo().clientid);
      this.openUniappPush();
      //#endif
    },
    onShow: function() {
      console.log('App Show')
    },
    onHide: function() {
      console.log('App Hide')
    },

    methods: {
      openUniappPush() {
        console.log('openUniappPush');
        plus.push.addEventListener('click', function(msg) {
          console.log('click',JSON.stringify(msg));
          //plus.nativeUI.toast('push click');
        });
        plus.push.addEventListener('receive', function(msg) {
          console.log('receive',JSON.stringify(msg));
          plus.nativeUI.toast('push receive');
          msg.content = msg.content ? msg.content : '后擎通';
          let platform = systemInfo().platform;
          if (platform == 'android') {
            plus.push.createMessage(msg.content, msg.payload);
          } else {
            if (msg.payload !== 'LocalMSG') {
              plus.push.createMessage(msg.content, "LocalMSG", {cover: false});
            } 
          }
        });
      }
    }
  }
</script>

<style>
  /*每个页面公共css */
</style>
